package com.ymatou.iapi.csim.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.csim.parameter.RemoveIndividualDiscourseCategoryByCategoryIdBean;
import com.ymatou.iapi.csim.parameter.SaveOrUpdateIndividualDiscourseCategoryBean;
import com.ymatou.iapi.csim.service.RemoveIndividualDiscourseCategoryByCategoryIdCall;
import com.ymatou.iapi.csim.service.SaveOrUpdateIndividualDiscourseCategoryCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CsimCallService;
import com.ymttest.database.model.ymt_individualdiscoursecatetory;
import com.ymttest.database.sqlwapper.CSIM.ymt_cssessionWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_individualdiscoursecatetoryWapper;
import com.ymttest.database.sqlwapper.CSIM.ymt_onlinecsWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
/**
*删除个人话术分类
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_RemoveIndividualDiscourseCategoryByCategoryId{
	private static RemoveIndividualDiscourseCategoryByCategoryIdBean bean;
	private static RemoveIndividualDiscourseCategoryByCategoryIdCall call;
	private Integer csId=Integer.parseInt(EnvSetup.getData("csId").toString());
	private static ymt_individualdiscoursecatetoryWapper individualdiscoursecatetoryWapper=new ymt_individualdiscoursecatetoryWapper();
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("删除个人话术分类");
	}

	@Before
	public void caseUp() {
		bean=new RemoveIndividualDiscourseCategoryByCategoryIdBean();
		call=new RemoveIndividualDiscourseCategoryByCategoryIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_RemoveIndividualDiscourseCategoryByCategoryId_1() {
		Logger.start(true,"删除个人话术分类");
		try {
			Logger.comment("前置条件-新增话术");
			SaveOrUpdateIndividualDiscourseCategoryBean categoryBean=new SaveOrUpdateIndividualDiscourseCategoryBean();
			SaveOrUpdateIndividualDiscourseCategoryCall categoryCall=new SaveOrUpdateIndividualDiscourseCategoryCall();
			
			categoryBean.setCategoryId(TestDataManager.getRandomUUID().toString());
			categoryBean.setTitle("自动化测试_"+TestDataManager.getRandomNum(5));
			categoryBean.setCsId(csId);
			categoryBean.setSort(1);
			categoryCall.setData(categoryBean);
			categoryCall.callService();
			
			bean.setCategoryId(categoryBean.getCategoryId());
			call.setData(bean);
			call.callService();		
			//验证
			Logger.verifyEquals("0", call.getResult().get("ErrorCode").toString(), "验证errorCode");
			Logger.verifyEquals(true, call.getResult().get("Success"), "验证Success");
			Logger.verifyEquals("200", call.getStatus(), "验证Status");
			ymt_individualdiscoursecatetory catetory=individualdiscoursecatetoryWapper.selectByPrimaryKey(bean.getCategoryId());
			Logger.verifyEquals(null, catetory.getCSId(), "验证为空");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}